package com.ucn.groupawesome.archgame;

import java.util.ArrayList;

public class Idea
{
	int id;
	ArrayList<Brick> ideaBricks;

	public Idea(int id)
	{
		super();
		this.id = id;
		this.ideaBricks = new ArrayList<Brick>();
	}

	public int getId()
	{
		return id;
	}
	
	public void setId(int id)
	{
		this.id = id;
	}

	public ArrayList<Brick> getIdeaBricks()
	{
		return ideaBricks;
	}

	public void setIdeaBricks(ArrayList<Brick> ideaBricks)
	{
		this.ideaBricks = ideaBricks;
	}

	public Brick findBrickInIdea(Brick brick)
	{
		for (Brick b : ideaBricks)
		{
			if (b.getName().equals(brick.getName()))
			{
				return b;
			}
		}

		return null;
	}

	public void addBrickToList(Brick brick)
	{
		if (findBrickInIdea(brick) == null)
		{
			ideaBricks.add(brick);
		}
	}

	public void removeBrickFromList(Brick brick)
	{
		if (findBrickInIdea(brick) != null)
		{
			ideaBricks.remove(brick);
		}
	}

	public int ideaBricksNum()
	{
		return ideaBricks.size();
	}

	public ArrayList<String> getIdeaBricksName()
	{
		ArrayList<String> temp = new ArrayList<String>();

		for (Brick b : ideaBricks)
		{
			temp.add(b.getName());
		}

		return temp;
	}
}
